import dayjs from 'dayjs'
import Vue from 'vue'
import 'dayjs/locale/zh-cn'
import isBetween from 'dayjs/plugin/isBetween'

dayjs.extend(isBetween)

export const currentDate = {
    date: dayjs().format('YYYY-MM-DD'),
    day: dayjs().day(),
    hour: dayjs().hour()
}

export function timeBetween(time, timeOne, timeTwo, type = 'day') {
    dayjs('').isBetween(dayjs(), dayjs(), type)
}

export function diffTime(startTime, endTime) {
    return dayjs(startTime).diff(dayjs(endTime), 'days')
}

Vue.prototype.$currentDate = currentDate
